//
//  LogisticsTableViewCell.m
//  ForestPack
//
//  Created by 郑洲 on 2018/7/20.
//  Copyright © 2018年 郑洲. All rights reserved.
//

#import "LogisticsTableViewCell.h"

@interface LogisticsTableViewCell ()

@property (nonatomic, strong) UILabel *timeLabel;
@property (nonatomic, strong) UILabel *addressLabel;
@property (nonatomic, strong) UIView *line;
@property (nonatomic, strong) UIImageView *noteIcon;

@end

@implementation LogisticsTableViewCell

+ (LogisticsTableViewCell *)cellWithTableView:(UITableView *)tableView andIndexPath:(NSIndexPath *)indexPath{
    static NSString *cellID = @"LogisticsTableViewCell";
    LogisticsTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil) {
        cell = [[LogisticsTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.backgroundColor = [UIColor whiteColor];
        [cell createSubView];
    }
    
    return cell;
}

- (void)createSubView {
    self.line = [[UIView alloc] initWithFrame:CGRectMake(ScreenX375(89), 0, 1, ScreenX375(64))];
    self.line.backgroundColor = LineColor;
    [self addSubview:self.line];
    
    self.noteIcon = [[UIImageView alloc] initWithFrame:CGRectMake(ScreenX375(85), ScreenX375(22), ScreenX375(10), ScreenX375(15))];
    self.noteIcon.image = ImageWithName(@"矢量智能对象拷贝3副本3");
    [self addSubview:self.noteIcon];
    
    self.timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(ScreenX375(30), ScreenX375(10), ScreenX375(52), ScreenX375(35))];
    self.timeLabel.text = @"05-19\n21:16";
    self.timeLabel.numberOfLines = 0;
    self.timeLabel.textAlignment = NSTextAlignmentCenter;
    self.timeLabel.font = Kfont(12);
    [self addSubview:self.timeLabel];
    
    self.addressLabel = [[UILabel alloc] initWithFrame:CGRectMake(ScreenX375(110), ScreenX375(14), ScreenX375(235), ScreenX375(36))];
    self.addressLabel.text = @"[收货地址]在广东区白云石转送在广东区在广东区白云石转送在广东区白云石转送在";
    self.addressLabel.numberOfLines = 0;
    self.addressLabel.font = Kfont(12);
    [self addSubview:self.addressLabel];
}

- (void)setStatu:(BOOL)isNow {
    if (isNow) {
        self.timeLabel.textColor = FONTCOLOR_BLACK;
        self.addressLabel.textColor = FONTCOLOR_BLACK;
        self.noteIcon.hidden = NO;
        self.line.frame = CGRectMake(ScreenX375(89), ScreenX375(15), 1, ScreenX375(49));
    }else {
        self.timeLabel.textColor = FONTCOLOR_LIGHTGRAY;
        self.addressLabel.textColor = FONTCOLOR_LIGHTGRAY;
        self.noteIcon.hidden = YES;
        self.line.frame = CGRectMake(ScreenX375(89), 0, 1, ScreenX375(64));
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
